<?php
showtipss($touclicklang['tcmsg0009'],'tips1',true,$touclicklang['tipsTitle4']);

if(submitcheck('mipsubmit')) {
	$ipf = $_POST['mipflag'];

	if($ipf != ""){
		
		$data = array(
				"b" => $touclickB,
				"z" => $touclickZ,
				"v" => $touclickV,
				"d" => $touclickD,
				"pf" => $touclickPF,
				'cs' => $touclickCS,
				"op" => "1002",
				"ip" => $ipf,
		);
		$resRep = touclick_request("http://api.touclick.com/monitor.touclick", $data, 80);

		if($resRep['content'] == "alert"){
			cpmsg("{$touclicklang['alert']}", "", 'error');
		}elseif($resRep['content'] == "alerts"){
			cpmsg("{$touclicklang['alerts']}", "", 'error');
		}elseif($resRep['content'] == "live"){
			cpmsg("{$touclicklang['live']}", "action=plugins&cp=$cp&pmod=activate&operation=$operation&do=$do", 'error');
		}elseif($resRep['content'] == "vip"){
			cpmsg("{$touclicklang['vip']}");
		}elseif($resRep['content'] == "yes"){
			cpmsg("{$touclicklang['yes']}", "action=plugins&cp=$cp&pmod=monitor&operation=$operation&do=$do", 'succeed');
		}else{
			cpmsg("{$touclicklang['others']}", "", 'error');
		}

	}else{
		cpmsg("{$touclicklang['paraneed']}", "", 'error');
	}
}

$data= array(
		"b" => $touclickB,
		"z" => $touclickZ,
		"v" => $touclickV,
		"d" => $touclickD,
		"op" => '1001',
		"pf" => $touclickPF,
		'cs' => $touclickCS,
);
$resRep = touclick_request("http://api.touclick.com/monitor.touclick", $data, 80);
// cpmsg($resRep['content']);
if($resRep['content'] == "alert"){
	cpmsg("{$touclicklang['alert']}", "", 'error');
}elseif($resRep['content'] == "alerts"){
	cpmsg("{$touclicklang['alerts']}", "", 'error');
}elseif($resRep['content'] == "live"){
	cpmsg("{$touclicklang['live']}", "action=plugins&cp=$cp&pmod=activate&operation=$operation&do=$do", 'error');
}elseif($resRep['content'] == "vip"){
	cpmsg("{$touclicklang['vip']}");
}

$isopen = $resRep['content'] ? "checked" : "";
$isclose = $isopen ? "" : "checked";

showformheader("plugins&cp=$cp&pmod=monitor&operation=$operation&do=$do", "",'monitoripform','post');
showtableheader($touclicklang['tcmsg0002']);
echo <<<EOF
<TR >
<TD class=td27 colSpan=2 s="1">{$touclicklang['tcmsg0004']}</TD></TR>
<TR class=noborder ><TD class="vtop rowform">
	<UL onmouseover=altStyleTc(this);>
	<LI class="{$isopen}"><INPUT class=radio type=radio value=1 autocomplete="off" {$isopen} name="mipflag">&nbsp;{$touclicklang['tcmsg0005']}</LI>
	<LI class="{$isclose}"><INPUT class=radio type=radio value=0 autocomplete="off" {$isclose} name="mipflag">&nbsp;{$touclicklang['tcmsg0006']}</LI></UL></TD>
</TR>
<tr><td><input id="mipsubmit" class="btn" type="submit" value="{$touclicklang['submit']}" name="mipsubmit"></td></tr>
EOF;
showtablefooter();
showformfooter();